package csu.rjxyg.action.courseAction;

import java.io.IOException;

import csu.rjxyg.action.BaseAction;
import csu.rjxyg.action.constant.CourseConstant;
import csu.rjxyg.dao.BaseDaoAdapter;
import csu.rjxyg.factory.core.DaoFactory;
import csu.rjxyg.factory.core.UtilFactory;
import csu.rjxyg.util.LogUtil;


public class DeleteCourseAction extends BaseAction {
	
	private String[] courseIdList;
	private LogUtil log;

	public String[] getCourseIdList() {
		return courseIdList;
	}

	public void setCourseIdList(String[] courseIdList) {
		this.courseIdList = courseIdList;
	}
	
	public DeleteCourseAction() {
		log = UtilFactory.getLogUtil(getClass());
	}
	
	public void deleteCourseBean() throws IOException {
		if (courseIdList == null) {
			this.out("error:请选择要删除的项！");
			return;
		}
		BaseDaoAdapter courseDao = DaoFactory
				.getDaoByColName(CourseConstant.COLLECTION_NAME);
		if (courseDao.deleteBean(courseIdList)) {
			this.out("success");
		} else {
			this.out("删除失败！请联系服务提供商");
		}
	}
}
